package com.study.suanfa;

import java.util.Arrays;

/**
 * @description: maopaoOrderTest  冒泡排序
 * @date: 2020/11/11 16:04
 * @author: hcm
 * @version: 1.0
 */
public class maopaoOrderTest {
    public static void main(String[] args) {
        int[] data = {9,8,7,6,5,4,3,2,1};

        //冒泡排序
          for(int i = 0 ; i<data.length;i++){
              for(int j = 0; j<data.length-i-1;j++){
                  //交换容器
                  int temp = 0;
                  if(data[j]>data[j+1]){
                      temp = data[j+1];
                      data[j+1] = data[j];
                      data[j] = temp;
                  }
              }
          }
        String s = Arrays.toString(data);
        System.out.println(s);

    }
}
